package com.gudaomai.wuye.web;

import java.util.Locale;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.MessageSource;
import org.springframework.context.i18n.LocaleContextHolder;

public abstract class BaseController {

	@Autowired
	protected MessageSource messageSource;
	
	/**
	 * 根据key获取国际化过的消息
	 * @param key
	 * @return
	 */
	protected String getMessage(String key) {
		Locale locale = LocaleContextHolder.getLocale();
		String msg = messageSource.getMessage(key, null,locale);
		return msg;
	}
}
